<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>历史资料</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="/static/wx/lib/sui/sm.min.css">
    <link rel="stylesheet" href="/static/wx/lib/sui/sm-extend.min.css">

    <link rel="stylesheet" href="/static/wx/css/reset.css">
    <link rel="stylesheet" href="/static/wx/css/main.css">
    <link rel="stylesheet" href="/static/wx/css/public_main.css">
</head>

<body>
    <div class="page-group">
        <div class="page page-current" id="dataList">
            <!-- 主内容 -->
            <div class="content">
                <div class="search-bar">
                    <div class="search-box">
                        <img src="/static/wx/imgs/icon/search.png" width="20" id="search-icon">
                        <input type="search" class="search-bar__input" id="searchInput" value="{$num|default=''}" data="{$status|default=''}" placeholder="搜索" required="">
                    </div>
                    <div class="search-select">
                        <input readonly="readonly" style="width: 100%;" value="{$name | default='全部'}" id="selectInput" onchange="change()"/>
                        <div style="display: none;" class="selectInputDiv" >
                            <ul style="list-style: none;margin: 0;padding: 0;text-align: center;">
                                {if($all == 1)}
                                <li >全部</li>
                                {/if}
                                <li value="1" {if(isset($status))}{if($status ==1)} selected {/if}{/if}>未递交审核</li>
                                <li value="2" {if(isset($status))}{if($status ==2)} selected {/if}{/if}>待审核</li>
                                <li value="3" {if(isset($status))}{if($status ==3)} selected {/if}{/if}>驳回</li>
                                <li value="4" {if(isset($status))}{if($status ==4)} selected {/if}{/if}>已完成</li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="content-block native-scroll">
                    <div class="list-block">
                        <ul>
                            {foreach($res as $k=>$v)}
                            <li>
                                <a href="{:url('Insurant/get_status',['policy_num'=>$v.policy_num])}" class="item-link item-content">
                                    <div class="item-inner">
                                        <div class="item-title">
                                            <div class="title-num size-n">报案号：{$v.policy_num}</div>
                                            <div class="time size-m">{$v.created_at}</div>
                                        </div>
                                        <div class="status">{$v.status_name}</div>
                                    </div>
                                </a>
                            </li>
                           {/foreach}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script type='text/javascript' src='/static/wx/lib/sui/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm-extend.min.js' charset='utf-8'></script>
    <script>
        $("#selectInput").click(function () {
            //点击输入框打开选项窗，若已打开则关闭
            var a = $(this).val();
            if ($(".selectInputDiv").css('display') == 'none') {
                $(".selectInputDiv").show();
                $('.selectInputDiv li:contains(' + $(this).val() + ')').css('background-color', 'orange');
            } else {
                $(".selectInputDiv").hide();
            }
        });
        $(".selectInputDiv li").click(function () {
            //点击选择时为输入框赋值。并关闭选项窗
            $("#selectInput").val($(this).text());
            $(".selectInputDiv").hide();
        });
        //为选项设置颜色
        $(".selectInputDiv li").mouseover(function () {
            $('.selectInputDiv li').css('background-color', 'white');
            $(this).css({
                'cursor': 'pointer',
                // 'background-color': 'orange'
            });
        });

        // $('#searchInput').bind('input propertychange', function() {
        //     var num= $('#searchInput').val();
        //     change(num,type);
        // });

        $(".selectInputDiv li").click(function () {
            //点击选择时为输入框赋值。并关闭选项窗
            $("#selectInput").val($(this).text())
            $(".selectInputDiv").hide();
            var num= $('#searchInput').val();
            var  type=$(this).val();
            change(num,type);
        });

        function change(num,type){
            var url="{:url('insurant/historyInfo')}?policy_num="+num+'&status='+type;
            window.location.href = url;
        }
        $('#search-icon').on('touchend',function () {
            var searchInput = $('#searchInput').val();
            var selectInput = $('#selectInput').val();
            var url="{:url('insurant/historyInfo')}?policy_num="+searchInput+'&status='+selectInput;
            window.location.href = url;
        })


    </script>
</body>


</html>